import 'package:flutter/material.dart';
import 'package:flutter_vant_ui/flutter_vant_ui.dart';

import '../../demos/demos.dart';

class VanDocDemoPopupSection extends StatelessWidget {
  const VanDocDemoPopupSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Popup")),
      body: SingleChildScrollView(
        child: Column(
          children: [
            const VanDocDemoBlockTitle(title: "基础用法", paddingTop: 20),
            Builder(builder: (context) {
              final controller = VanPopupController();
              return Column(children: [
                VanCell(title: "展示弹出层", isLink: true, onClick: () => controller.show = true),
                VanPopup(controller: controller, child: const Padding(
                  padding: EdgeInsets.all(64.0),
                  child: Text("内容"),
                )),
              ]);
            }),
            //
            const VanDocDemoBlockTitle(title: "弹出位置(暂未实现)"),
            // VanDocDemoPopupButtonGroup(children: [
            //   VanDocDemoPopupButton(icon: Icons.keyboard_arrow_up, child: "顶部弹出"),
            //   VanDocDemoPopupButton(icon: Icons.keyboard_arrow_down, child: "底部弹出"),
            //   VanDocDemoPopupButton(icon: Icons.keyboard_arrow_left, child: "左侧弹出"),
            //   VanDocDemoPopupButton(icon: Icons.keyboard_arrow_right, child: "右侧弹出"),
            // ]),
            //
            const VanDocDemoBlockTitle(title: "关闭图标"),
            Builder(builder: (context) {
              final controller = VanPopupController();
              return VanCellGroup(inset: true, children: [
                VanCell(
                  title: '关闭图标',
                  isLink: true,
                  onClick: () {},
                ),
                VanCell(
                  title: '自定义图标',
                  isLink: true,
                  onClick: () {},
                ),
                VanCell(
                  title: '图标位置',
                  isLink: true,
                  onClick: () {},
                ),
              ]);
            }),
            //
            const VanDocDemoBlockTitle(title: "圆角弹窗"),
            Builder(builder: (context) {
              final controller = VanPopupController();
              return VanCellGroup(inset: true, children: [
                VanCell(
                  title: '圆角弹窗(居中)',
                  isLink: true,
                  onClick: () {},
                ),
                VanCell(
                  title: '圆角弹窗(底部)',
                  isLink: true,
                  onClick: () {},
                ),
              ]);
            }),
            //
            const VanDocDemoBlockTitle(title: "监听事件"),
            Builder(builder: (context) {
              final controller = VanPopupController();
              return VanCellGroup(inset: true, children: [
                VanCell(
                  title: '监听点击事件',
                  isLink: true,
                  onClick: () {},
                ),
                VanCell(
                  title: '监听显示事件',
                  isLink: true,
                  onClick: () {},
                ),
              ]);
            }),
            // VanRow(gutter: 10,children: [
            //
            // ],)
            // Wrap(spacing: 8, children: [
            //  Flexible(child: child)
            // ])
          ],
        ),
      ),
    );
  }
}
